#include <cmath>
#include <iostream>
#include <cstdio>
#include <algorithm>

#define x first
#define y second

using namespace std;

const int N = 1e6 + 10;

typedef pair<int, int> PII;
typedef long long LL;

int n, m;

int p[N];

struct Node
{
	int a, b;
	double w;
	
	bool operator< (const Node &t)const
	{
		return w < t.w;
	}
}q[N];

PII t[N];
//int p[N];

int find(int x)
{
	if (p[x] != x) p[x] = find(p[x]);
	return p[x];
}


double get_dist(PII a, PII b)
{
	int dx = a.x - b.x;
	int dy = a.y - b.y;
	
	return (double)sqrt((LL)dx * dx + (LL)dy * dy);
}

double kruskal(int cnt)
{
	sort(q, q + cnt);
	
	double res = 0;
	
	for (int i = 0; i < cnt; i ++ )
	{
		if (n == 1) return res;
		auto e = q[i];
		
		int a = e.a, b = e.b;
		double w = e.w;
//		cout << n << endl;
//		cout << a << "====" << b << "====" << w << endl;
		
		int pa = find(a), pb = find(b);
		
		
		
		if (pa != pb)
		{
			p[pa] = pb;
			res += w;
			n -- ;
		}
	}
}

int main()
{
	cin >> n >> m;
	
	for (int i = 1; i <= n; i ++ )
	{
		cin >> t[i].x >> t[i].y;	
		p[i] = i;
	}
	
	int cnt = 0;
	
	for (int i = 1; i <= n; i ++ )
	{
		for (int j = i + 1; j <= n; j ++ )
		{
			q[cnt ++ ] = {i, j, get_dist(t[i], t[j])};
		}
	}
	
	for (int i = 0; i < m; i ++ )
	{
//		if (n == 1) return res;
		int a, b;
		cin >> a >> b;
		
		int pa = find(a), pb = find(b);
//		cout << pa << "---" << pb << endl;
		if (pa != pb) 
		{
			p[pa] = pb;
			n -- ;	
		}
	}
	
	double res = kruskal(cnt);
	
	printf("%.2lf", res);
	
	return 0;
}
//----------------------------
//prim算法
#include <iostream>
#include <cstring>
#include <cmath>

#define x first
#define y second

using namespace std;

typedef pair<int, int> PII;
typedef long long LL;

const int N = 1e3 + 10;

double g[N][N];
double dist[N];

bool st[N];

PII q[N];

int n, m;

double prim()
{
	double res = 0;
	
	for (int i = 0; i < n; i ++ )
	{
		int t = -1;
		
		for (int j = 1; j <= n; j ++ )
		{
			if (!st[j] && (t == -1 || dist[j] < dist[t])) t = j;
		}
		
		if (i)res += dist[t];
		st[t] = true;
		
		for (int j = 1; j <= n; j ++ )
		{
			dist[j] = min(dist[j], g[t][j]);
		}
	}
	
	return res;
}

double get_dist(PII a, PII b)
{
	LL dx = a.x - b.x;
	LL dy = a.y - b.y;
	
	return sqrt(dx * dx + dy * dy);
}

int main()
{
	cin >> n >> m;
	
	for (int i = 1; i <= n; i ++ ) 
	{
//		int a, b;
		cin >> (q[i].x) >> (q[i].y);
		dist[i] = 1e18;
	}
	
//	memset(g, 0x3f, sizeof g);
//	memset(dist, 0x3f, sizeof dist);

//	for ()
	
	for (int i = 1; i <= n; i ++ )
	{
		for (int j = 1; j <= n; j ++ )
		{
			g[i][j] = g[j][i] = get_dist(q[i], q[j]);
		}
	}
	
	for (int i = 0; i < m; i ++ )
	{
		int a, b;
		cin >> a >> b;
		g[a][b] = g[b][a] = 0;
	}
	
	double res = prim();
	
	printf("%.2lf", res);
	
	return 0;
}